<template>
  <div class="main_style">
    <crumbs :BreadCrumb="BreadCrumb"></crumbs>
    <el-form
        :inline="true"
        :model="searchForm"
        class="demo-form-inline text-center"
        @submit.native.prevent
    >
      <el-form-item label="体检日期">
        <el-date-picker
            v-model="checkDate"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
        >
        </el-date-picker>
      </el-form-item>

      <el-form-item label="单位名称">
        <el-input v-model="searchForm.enterpriseName"></el-input>
      </el-form-item>
      <el-form-item label="合同名称">
        <el-input v-model="searchForm.contractName"></el-input>
      </el-form-item>
      <el-form-item class="staff_form_btn">
        <el-button @click="getList" type="primary">查找</el-button>
      </el-form-item>
    </el-form>
    <div class="title1">
      <el-table
          :data="scanCodeInfoTotal"
          class="smjbtablestyle"
          :header-cell-style="headerstyle"
          border
          style="width: 100%;font-size: 26px;line-height: 32px;"
          :row-key="record=>record.id"
          :row-style="{height:'50px'}"
          :cell-style="{padding:'0px'}"
      >
        <el-table-column label="已登记人数" align="center" prop="todayCheckCount"></el-table-column>
        <el-table-column  label="交表人数" align="center" prop="todayInTableCount"></el-table-column>
        <el-table-column  label="未交表人数" align="center" prop="todayNoTableCount"></el-table-column>
      </el-table>
    </div>

    <el-table :data="personDetailVoList" border class="smjbtablestyle" :header-cell-style="headerstyle">
      <el-table-column align="center" prop="enterpriseName" label="单位名称" width="150"></el-table-column>
      <el-table-column align="center" prop="contractName" label="团体合同"></el-table-column>
      <el-table-column align="center" prop="todayPersonCount" label="成员人数"></el-table-column>
      <el-table-column align="center" prop="todayCheckCount" label="登记人数"></el-table-column>
      <el-table-column align="center" prop="todayNoCheckCount" label="未登记人数" width="150"></el-table-column>
      <el-table-column align="center" prop="todayInTableCount" label="交表人数" width="150"></el-table-column>
      <el-table-column align="center" prop="todayNoTableCount" label="未交表人数"></el-table-column>
    </el-table>
  </div>
</template>
<script>
import crumbs from "@src/views/Crumbs";
import {formatTimeToStr} from "@src/common/utils/date";
export default {
  components: {
    crumbs,
  },
  name: "confirmList",
  data() {
    return {
      BreadCrumb: [
        {path: "", name: "查询统计"},
        {path: "/visitphysician/confirmList", name: "收表查询"},
      ],
      checkDate:[
        formatTimeToStr(new Date(), "yyyy-MM-dd"),
        formatTimeToStr(new Date(), "yyyy-MM-dd")
      ],
      handTableForm: {},
      searchForm: {
        "medicalDate":1,//必传获取今日的数据
        "status":8 //必传获取已交表的数据
      },
      personDetailVoList: [],
      scanCodeInfoTotal: [],
      confirmVisble:false,
      ItemsList:[],
      peCustomers:{},
      orderId:'',
      headerstyle:{
        color:'#000',
        background:'#f2f2f2',
      },
      pageSize: 10,
      pageNo: 1,
      total: 0,
      todayInTableCount:0,
      checked:false
    }
  },
  filters:{
    formatDate: function (time) {
      if (time != null && time !== "") {
        var date = new Date(time);
        return formatTimeToStr(date, "yyyy-MM-dd hh:mm");
      } else {
        return "";
      }
    },
    formatCustomerStatus: function (val){
      var dict = {1: "正常", 2: "无效", 3: "限制", 4: "拉黑", 5: "死亡"}
      return dict[val]
    },
    formatSex: function (val) {
      var dict = {1: "男", 2: "女"}
      return dict[val]
    },
  },
  created(){
    this.getList()
  },
  methods: {
    // 列表获取
    getList() {
      if(this.checkDate && this.checkDate.length===2){
        this.searchForm.startSignDatetime=this.checkDate[0]
        this.searchForm.endSignDatetime=this.checkDate[1]
      }else {
        delete this.searchForm.startSignDatetime
        delete this.searchForm.endSignDatetime
      }
      this.doGetList(this.searchForm)
    },
    doGetList(req){
      this.$axios.receiveFormReportList(req).then(res=>{
        if (res.success) {
          const data = res.data
          this.scanCodeInfoTotal = [
              {
                todayCheckCount:data.todayCheckCount,
                todayInTableCount:data.todayInTableCount,
                todayNoTableCount:data.todayNoTableCount
              }
          ]
          this.personDetailVoList = data.personDetailVoList
        }
      })
    },
    handleSizeChange(val) {
      this.pageSize = val
      this.doGetList()
    },
    // 第几页
    handleCurrentChange(val) {
      this.pageNo = val
      this.doGetList()
    },
  }
}
</script>

<style scoped>
.toptitle{
  margin-right: 30px;
}
.main_style{
  background: #fff;
  padding: 10px;
}
.el-table /deep/.cell{
  line-height: 30px;
}
.title1{
  margin-bottom: 20px;
}
.checked{
  margin-left: 30px;
}
</style>
